home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / MESSAGEB.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  114 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Definition of class TMessageBar.
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_MESSAGEB_H)
  10. #define OWL_MESSAGEB_H
  11.  
  12. #if !defined(OWL_GADGETWI_H)
  13. # include <owl/gadgetwi.h>
  14. #endif
  15.  
  16. #if defined(BI_NAMESPACE)
  17. namespace OWL {
  18. #endif
  19.  
  20. // Generic definitions/compiler options (eg. alignment) preceeding the 
  21. // definition of classes
  22. #include <services/preclass.h>
  23.  
  24. const int IDW_STATUSBAR     = 32040;  // Window ID used to locate status bars
  25.  
  26. //
  27. // class TMessageBar
  28. // ~~~~~ ~~~~~~~~~~~
  29. // Implements a message bar with one text gadget as wide as the window and no
  30. // border. positions itself at the bottom of the window and uses the default
  31. // decoration bar font
  32. //
  33. // The message bar optionally draws a highlight line at the top
  34. //
  35. class _OWLCLASS TMessageBar : public TGadgetWindow {
  36.   public:
  37.     TMessageBar(TWindow*   parent = 0,
  38.                 TFont*     font = new TGadgetWindowFont,
  39.                 TModule*   module = 0);
  40.    ~TMessageBar();
  41.  
  42.     // Set the text for the default text message gadget or a text gadget by id
  43.     //
  44.     void    SetText(const char* text);
  45.     void    SetMessageText(int id, const char* text);
  46.  
  47.     // Set (or clear if 0) menu/command item hint text displayed in/on bar
  48.     //
  49.     virtual void    SetHintText(const char* text);
  50.  
  51.   protected:
  52.     // Compensate for highlight line
  53.     //
  54.     void   GetInnerRect(TRect& rect);
  55.     void   GetDesiredSize(TSize& rect);
  56.  
  57.     // Draw highlight line, then HintText if any, or gadgets
  58.     //
  59.     void   PaintGadgets(TDC& dc, bool erase, TRect& rect);
  60.  
  61.     bool   GetHighlightLine() const;
  62.     void   SetHighlightLine(bool highlightline);
  63.  
  64.     const char*  GetHintText() const;
  65.  
  66.   protected_data:
  67.     bool   HighlightLine;  // does this bar have a upper highlight line?
  68.     char*  HintText;       // current command hint being displayed, if any
  69.  
  70.   private:
  71.     // Hidden to prevent accidental copying or assignment
  72.     //
  73.     TMessageBar(const TMessageBar&);
  74.     TMessageBar& operator =(const TMessageBar&);
  75.  
  76.   DECLARE_CASTABLE;
  77. };
  78.  
  79. // Generic definitions/compiler options (eg. alignment) following the 
  80. // definition of classes
  81. #include <services/posclass.h>
  82.  
  83. #if defined(BI_NAMESPACE)
  84. } // namespace OWL
  85. #endif
  86.  
  87. //----------------------------------------------------------------------------
  88. // Inline implementations
  89. //
  90.  
  91. //
  92. // Returns true if the message bar has an upper highlight line.
  93. //
  94. inline bool TMessageBar::GetHighlightLine() const {
  95.   return HighlightLine;
  96. }
  97.  
  98. //
  99. // Sets the flag for the message bar to have an upper highlight line.
  100. //
  101. inline void TMessageBar::SetHighlightLine(bool highlightline) {
  102.   HighlightLine = highlightline;
  103. }
  104.  
  105. //
  106. // Return the cached hint text for the current message.
  107. //
  108. inline const char* TMessageBar::GetHintText() const {
  109.   return HintText;
  110. }
  111.  
  112.  
  113. #endif  // OWL_MESSAGEB_H
  114.